﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace TouchExplorer
{
    /// <summary>
    /// Interaction logic for CurrentDirectories.xaml
    /// </summary>
    public partial class CurrentDirectories : Grid
    {
        private ExplorerViewModel Model
        {
            get
            {
                return DataContext as ExplorerViewModel;
            }
        }

        public CurrentDirectories()
        {
            InitializeComponent();
        }

        private void MoveUp_Click(object sender, RoutedEventArgs e)
        {
            if (Model.CurrentPath.Count > 1)
            {
                Model.CurrentPath.RemoveAt(Model.CurrentPath.Count-1);
                var dir = Model.CurrentPath[Model.CurrentPath.Count - 1];
                Model.CurrentPath.Remove(dir);
                Model.SelectedDirectory = dir;
            }
            else
            {
                Model.CurrentPath.Clear();
                Model.SelectedDirectory = null;
            }
        }
    }
}
